package generic;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlRootElement;

import domainspecific.types.Interval;

@XmlRootElement
public class Request implements Serializable {
	private double id;
	private long tFrom;
	private long numReadings;
	private Interval interval;
	private static long defaultNumReadings = 0;
	private static String defaultInterval = "MINUTE";
	static
	{
		if(System.getenv().containsKey("READINGS_NUMREADINGS")){
			defaultNumReadings = Long.parseLong(System.getenv().get("READINGS_NUMREADINGS"));
		}
		if(System.getenv().containsKey("READINGS_INTERVAL")){
			defaultInterval = System.getenv().get("READINGS_INTERVAL");
		}
	}
	
	public Request()
	{
		this.id = Math.random() * 100000;
		this.tFrom=(int)(Math.random()*(java.lang.System.currentTimeMillis()/1000));
		this.numReadings = defaultNumReadings;
		this.interval=Interval.valueOf(defaultInterval);
	}

	public double getId() {
		return id;
	}

	public void setId(double id) {
		this.id = id;
	}

	public long gettFrom() {
		return tFrom;
	}

	public void settFrom(long tFrom) {
		this.tFrom = tFrom;
	}

	public Interval getInterval() {
		return interval;
	}

	public void setInterval(Interval interval) {
		this.interval = interval;
	}

	public long getNumReadings() {
		return numReadings;
	}

	public void setNumReadings(long numReadings) {
		this.numReadings = numReadings;
	}

	
	
}
